package com.visizen.wisdomclass.server.client;

import com.visizen.wisdomclass.server.model.WcTeacherCourse;
import com.visizen.wisdomclass.server.model.WcTeacherCourseExample;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

public interface WcTeacherCourseMapper {
    @Select("SELECT * FROM wc_teacher_course WHERE organization_id=#{classId} and user_id=#{teacherId}")
    WcTeacherCourse selectByTeacherIdClassId(Long teacherId, Long classId);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_teacher_course
     *
     * @mbggenerated
     */
    @SelectProvider(type = WcTeacherCourseSqlProvider.class, method = "countByExample")
    int countByExample(WcTeacherCourseExample example);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_teacher_course
     *
     * @mbggenerated
     */
    @DeleteProvider(type = WcTeacherCourseSqlProvider.class, method = "deleteByExample")
    int deleteByExample(WcTeacherCourseExample example);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_teacher_course
     *
     * @mbggenerated
     */
    @Delete({"delete from wc_teacher_course",
            "where id = #{id,jdbcType=BIGINT}"})
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_teacher_course
     *
     * @mbggenerated
     */
    @Insert({
            "insert into wc_teacher_course (id, organization_id, ",
            "user_id, course_id)",
            "values (#{id,jdbcType=BIGINT}, #{organization_id,jdbcType=BIGINT}, ",
            "#{user_id,jdbcType=BIGINT}, #{course_id,jdbcType=BIGINT})"})
    int insert(WcTeacherCourse record);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_teacher_course
     *
     * @mbggenerated
     */
    @InsertProvider(type = WcTeacherCourseSqlProvider.class, method = "insertSelective")
    int insertSelective(WcTeacherCourse record);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_teacher_course
     *
     * @mbggenerated
     */
    @SelectProvider(type = WcTeacherCourseSqlProvider.class, method = "selectByExample")
    @Results({
            @Result(column = "id", property = "id", jdbcType = JdbcType.BIGINT, id = true),
            @Result(column = "organization_id", property = "organization_id", jdbcType = JdbcType.BIGINT),
            @Result(column = "user_id", property = "user_id", jdbcType = JdbcType.BIGINT),
            @Result(column = "course_id", property = "course_id", jdbcType = JdbcType.BIGINT)})
    List<WcTeacherCourse> selectByExample(WcTeacherCourseExample example);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_teacher_course
     *
     * @mbggenerated
     */
    @Select({"select", "id, organization_id, user_id, course_id",
            "from wc_teacher_course", "where id = #{id,jdbcType=BIGINT}"})
    @Results({
            @Result(column = "id", property = "id", jdbcType = JdbcType.BIGINT, id = true),
            @Result(column = "organization_id", property = "organization_id", jdbcType = JdbcType.BIGINT),
            @Result(column = "user_id", property = "user_id", jdbcType = JdbcType.BIGINT),
            @Result(column = "course_id", property = "course_id", jdbcType = JdbcType.BIGINT)})
    WcTeacherCourse selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_teacher_course
     *
     * @mbggenerated
     */
    @UpdateProvider(type = WcTeacherCourseSqlProvider.class, method = "updateByExampleSelective")
    int updateByExampleSelective(@Param("record") WcTeacherCourse record,
                                 @Param("example") WcTeacherCourseExample example);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_teacher_course
     *
     * @mbggenerated
     */
    @UpdateProvider(type = WcTeacherCourseSqlProvider.class, method = "updateByExample")
    int updateByExample(@Param("record") WcTeacherCourse record,
                        @Param("example") WcTeacherCourseExample example);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_teacher_course
     *
     * @mbggenerated
     */
    @UpdateProvider(type = WcTeacherCourseSqlProvider.class, method = "updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(WcTeacherCourse record);

    /**
     * This method was generated by MyBatis Generator. This method corresponds to the database table wc_teacher_course
     *
     * @mbggenerated
     */
    @Update({"update wc_teacher_course",
            "set organization_id = #{organization_id,jdbcType=BIGINT},",
            "user_id = #{user_id,jdbcType=BIGINT},",
            "course_id = #{course_id,jdbcType=BIGINT}",
            "where id = #{id,jdbcType=BIGINT}"})
    int updateByPrimaryKey(WcTeacherCourse record);
}